const { success, failure } = require("../../utils/responses");
const chapterLikesService = require("../../services/learn/chapterLikesService");

/**
 * 点赞
 * @param req
 * @param res
 * @returns {Promise<void>}
 */
exports.like = async (req, res) => {
  try {
    const message = await chapterLikesService.like(req);
    success(res, message);
  } catch (error) {
    failure(res, error);
  }
};

/**
 * 获取用户评论的点赞列表
 * @param req
 * @param res
 * @returns {Promise<void>}
 */
exports.userLikeList = async (req, res) => {
  try {
    const rows = await chapterLikesService.userLikeList(req.query.userId);
    success(res, "获取用户点赞", rows);
  } catch (error) {
    failure(res, error);
  }
};
